package main

import "fmt"

func finalPrices(prices []int) []int {
	result := make([]int, len(prices))
	for i, v := range prices {
		cut := 0
		for j := i + 1; j < len(prices); j++ {
			if prices[j] <= v {
				cut = prices[j]
				break
			}
		}
		result[i] = v - cut
	}
	return result
}

func main() {
	fmt.Printf("%#v\n", finalPrices([]int{8, 4, 6, 2, 3}))
	fmt.Printf("%#v\n", finalPrices([]int{1, 2, 3, 4, 5}))
	fmt.Printf("%#v\n", finalPrices([]int{10, 1, 1, 6}))
}
